package com.example.service;

import com.example.entity.Slideshow;
import com.example.mapper.SlideshowMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SlideshowService {
    @Resource
    private SlideshowMapper slideshowMapper;

    public void add(Slideshow slideshow) {
        slideshowMapper.insert(slideshow);
    }

    public PageInfo<Slideshow> selectPage(Integer pageNum, Integer pageSize,Slideshow slideshow) {
        PageHelper.startPage(pageNum, pageSize);
        List<Slideshow> list = slideshowMapper.selectAll(slideshow);
        return PageInfo.of(list);
    }

    public void update(Slideshow slideshow) {
        slideshowMapper.updateById(slideshow);
    }

    public void deleteById(Integer id) {
        slideshowMapper.deleteById(id);
    }
}
